import request from "../utils/request";


export function getUser(openid) {
    return request({
        url: '/api/user/getUser?openid=' + openid,
        method: 'GET'
    })
}

export function getUserStatistics(openid) {
    return request({
        url: '/api/user/getUserStatistics?openid=' + openid,
        method: 'GET'
    })
}

/**
 * 得到openid信息
 * @param res
 * @returns {Promise | Promise<unknown>}
 */
export function getWeixinOpenid(res) {
    return request({
        url: '/api/user/getWeixinOpenid?js_code=' + res.code,
        method: 'GET'
    })
}

/**
 * 保存用户
 * @param data
 * @returns {Promise | Promise<unknown>}
 */
export function saveUser(data) {
    return request({
        url: '/api/user/saveUser',
        method: 'POST',
        data
    });
}


export function updateCity(data) {
    return request({
        url: '/api/user/updateCity',
        method: 'POST',
        data
    });
}

export function registerUser(data) {
    return request({
        url: '/api/user/registerUser',
        method: 'POST',
        data
    });
}


export function updateUserInfo(data) {
    return request({
        url: '/api/user/updateUserInfo',
        method: 'POST',
        data
    });
}

export function getHelpList() {
    return request({
        url: '/api/help/findHelps',
        method: 'GET'
    });
}
export function getHelpDetail(id) {
    return request({
        url: `/api/help/getHelp/${id}`,
        method: 'GET'
    });
}


export function teams(id) {
    return request({
        url: `/api/user/teams/${id}`,
        method: 'GET'
    });
}
export function myteams(id) {
    return request({
        url: `/api/user/myteams/${id}`,
        method: 'GET'
    });
}

export function teamDetail(id) {
    return request({
        url: `/api/user/teamDetail/${id}`,
        method: 'GET'
    });
}

export function myShopList(data) {
    return request({
        url: `/api/shop/myShopList`,
        method: 'POST',
        data
    });
}

export function userstastics(id) {
    return request({
        url: `/api/user/userstastics/${id}`,
        method: 'GET'
    });
}

export function getTeamUserList(id) {
    return request({
        url: `/api/user/childUsers/${id}`,
        method: 'POST'
    });
}

export function authInfo(id, data) {
    return request({
        url: `/api/user/authInfo/${id}`,
        method: 'POST',
        data
    });
}


export function toBeBindShop() {
    return request({
        url: `/api/shop/toBeBindShop`,
        method: 'GET'
    });
}

export function bindShop(adminId,shopId) {
    return request({
        url: `/api/shop/bindShop/${adminId}/${shopId}`,
        method: 'GET'
    });
}

export function noParentIdAdmin() {
    return request({
        url: `/api/user/noParentIdAdmin`,
        method: 'GET'
    });
}
export function saveTeamAddSp(data) {
    return request({
        url: `/api/user/saveTeamAddSp`,
        method: 'POST',
        data
    });
}

export function applyPorxy(data) {
    return request({
        url: `/api/user/applyPorxy`,
        method: 'POST',
        data
    });
}


export function verify(userId){
    return request({
        url: `/api/verify/getList/${userId}`,
        method: 'GET'
    });
}
export function verifyDetail(id){
    return request({
        url: `/api/verify/getModel/${id}`,
        method: 'GET'
    });
}

